/**
* @file Simulator.cpp in SimulateLPS
* @author rebeater
* @comment
* Create on 3/22/22 10:58 PM
* @version 1.0
**/


#include "Simulator.h"
bool Simulator::SerialOutput(char *data, int size) const {
  if (serial_->isOpen()) {
	serial_->write(data, size);
	serial_->flush();
  }
  return serial_->error()==QSerialPort::NoError;
}
Simulator::Simulator(const QSerialPortInfo &info) {
  serial_ = new QSerialPort(info);
  serial_->setBaudRate(115200);
  serial_->open(QSerialPort::WriteOnly);
}
Simulator::~Simulator() {
  delete serial_;
}
QSerialPort::SerialPortError Simulator::GetError() const {
  return serial_->error();
}
Simulator::Simulator() {
  serial_ = new QSerialPort();
}
void Simulator::SetSerialPortInfo(const QSerialPortInfo &info) {
  serial_->setPort(info);
  serial_->setBaudRate(115200);
  serial_->open(QSerialPort::WriteOnly);
}

